import axios from 'axios';
import {API_NEW_VERSION} from '../api';

let qs = require('qs');

export const getAllStandardPriceVersions = params => {
  return axios.get(API_NEW_VERSION + 'standard-price-versions', {params: params});
};

export const createStandardPriceVersion = (id, params) => {
  return axios.post(API_NEW_VERSION + 'standard-prices/' + id + '/standard-price-versions', params);
};

export const copyStandardPriceVersion = (id, value) => {
  return axios.post(API_NEW_VERSION + 'standard-price-versions/' + id + '/copy', qs.stringify({description: value}));
};

export const updateStandardPriceVersion = params => {
  return axios.put(API_NEW_VERSION + 'standard-price-versions', params);
};

export const getStandardPriceVersion = id => {
  return axios.get(API_NEW_VERSION + 'standard-price-versions/' + id);
};

export const deleteStandardPriceVersion = id => {
  return axios.delete(API_NEW_VERSION + 'standard-price-versions/' + id);
};

export const emptyStandardPriceVersion = id => {
  return axios.delete(API_NEW_VERSION + 'standard-price-versions/' + id + '/empty');
};

export const submitStandardPriceVersion = id => {
  return axios.post(API_NEW_VERSION + 'standard-price-versions/' + id + '/submit');
};
